package com.datastructure.test.maxwaterofcontainer;

public class MaxWaterOfContainer {

    public static void main(String[] args) {

    }

    public int getMaxWaterOfContainer(int[] height){
        int result = 0;
        int maxHeight = 0;
        for (int i = 0; i < height.length; i++) {
            if(i>0&&height[i]<=maxHeight){
                continue;
            }
            maxHeight=Math.max(maxHeight,height[i]);
            int end = height.length-1;
            while (i<end){
                result = Math.max(result,(end-i)*Math.min(height[i], height[end]));
                end--;
            }
        }
        return result;
    }
}
